module CnSms
  module Adapter
    class Routo < Base
      def initialize(config)
        ::Routo.username = config['username']
        ::Routo.password = config['password']
        ::Routo.ownnum = config["from"]
        ::Routo.type = "SMS"
      end

      def send(phone,msg)
        super(phone,msg)
        phone = phone.delete "+"
        ::Routo.send_sms msg,phone
        puts "sms sent phone:#{phone}. Message:#{msg}"
      end
    end
  end
end